package com.qidian.mes.md.controller;

import com.qidian.mes.md.service.MdToolResourceService;
import com.qidian.mes.md.vo.MdToolResourceVO;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: CoolPro
 * @Description:
 * @Time: 2024-04-11 16:15
 **/

@RestController
@RequestMapping("/vs")
@CrossOrigin
public class MdToolResourceController {
    @Autowired
    MdToolResourceService mdToolResourceService;

    //添加
    @PostMapping("/add")
    public QdResult addToolResources(@RequestBody MdToolResourceVO mdToolResourceVO){
        return mdToolResourceService.insertToolResources(mdToolResourceVO);
    }


    //修改
    @PutMapping("/update")
    public QdResult updateToolResources(@RequestBody MdToolResourceVO mdToolResourceVO){
        return mdToolResourceService.updateToolResources(mdToolResourceVO);
    }

    //删除
    @DeleteMapping("/delete")
    public QdResult deleteToolResources(@RequestBody MdToolResourceVO mdToolResourceVO){
        return mdToolResourceService.deleteToolResources(mdToolResourceVO);
    }

    //根据工作站ID去查询
    @GetMapping("/work")
    public QdResult getToolResources(@RequestParam Integer idWork){
        return mdToolResourceService.getToolResources(idWork);
    }
    //查询所有内容
    @GetMapping("")
    public QdResult getToolsByName(@RequestParam String toolName){
        return mdToolResourceService.getToolsByName(toolName);
    }
}
